package com.aaa.sbms.controller;

import com.aaa.sbms.service.RecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("recruit")
public class RecruitController {

    @Autowired(required = false)
    private RecruitService recruitService;

    /**
     * 查询部门信息
     * @return
     */
    @RequestMapping("depts")
    public Map depts(){
        return recruitService.depts();
    }

    /**
     * 查询职位信息
     * @return
     */
    @RequestMapping("positions")
    public Map positions(){
        return recruitService.positions();
    }

    /**
     * 分页查询招聘信息
     * @return
     */
    @RequestMapping("getPage")
    public Map getPage(@RequestParam Map map){
        return recruitService.getList(map);
    }

    /**
     * 分页查询应聘者信息
     * @return
     */
    @RequestMapping("recruitPage")
    public Map recruitPage(@RequestParam Map map){
        return recruitService.recruitPage(map);
    }

    /**
     * 分页查询审核记录
     * @return
     */
    @RequestMapping("recruitRecordPage")
    public Map recruitRecordPage(@RequestParam Map map){
        return recruitService.recruitRecordPage(map);
    }

    /**
     * 分页查询入职者信息
     * @return
     */
    @RequestMapping("empPage")
    public Map empPage(@RequestParam Map map){
        return recruitService.empPage(map);
    }

    /**
     * 查询一条招聘信息
     * @param id
     * @return
     */
    @RequestMapping("recruitInfoOne")
    public Map recruitInfoOne(Integer id){
        return recruitService.recruitInfoOne(id);
    }

    /**
     * 查询一条招聘信息
     * @param id
     * @return
     */
    @RequestMapping("recruitOne")
    public Map recruitOne(Integer id){
        return recruitService.recruitOne(id);
    }

    /**
     * 添加招聘信息
     * @param map
     * @return
     */
    @RequestMapping("addRecruitInfo")
    public int addRecruitInfo(@RequestBody Map map){
        return recruitService.addRecruitInfo(map);
    }

    /**
     * 添加应聘者信息
     * @param map
     * @return
     */
    @RequestMapping("addRecruit")
    public int addRecruit(@RequestBody Map map){
        return recruitService.addRecruit(map);
    }

    /**
     * 更新招聘信息
     * @param map
     * @return
     */
    @RequestMapping("updateRecruitInfo")
    public int updateRecruitInfo(@RequestBody Map map){
        return recruitService.updateRecruitInfo(map);
    }

    /**
     * 根据id删除招聘信息
     * @param id
     * @return
     */
    @RequestMapping("deleteRecruitInfo")
    public int deleteRecruitInfo(Integer id){
        return recruitService.deleteRecruitInfo(id);
    }

    /**
     * 同意入职申请
     * @param map
     * @return
     */
    @RequestMapping("accept")
    public Object accept(@RequestBody Map map){
        return recruitService.accept(map);
    }

    /**
     * 驳回入职申请
     * @param map
     * @return
     */
    @RequestMapping("reject")
    public Object reject(@RequestBody Map map){
        return recruitService.reject(map);
    }
}
